package com.hxx.mapper;

import com.hxx.domain.Person;
import org.apache.ibatis.annotations.*;

import java.util.List;

@Mapper
public interface PersonMapper {

    @Select("SELECT * FROM person")
    List<Person> selectAll();

    @Insert("INSERT INTO person(username, sex, age) VALUES (#{username}, #{sex}, #{age}")
    void insert(Person person);

    @Delete("DELETE FROM person WHERE id = #{id}")
    void delete(int id);

    @Update("UPDATE person SET username = #{username}, " +
            "sex = #{sex}, age = #{age} WHERE id = #{id}")
    void update(Person person);

    @Select("SELECT * FROM person WHERE id = #{id}")
    Person selectById(int id);
}




























